package com.rest.demo.io;

import java.io.*;

/**
 * @author Administrator
 * @decription
 * @Date 2018-02-05 14:14
 */
public class CopyFileDemo {
    public static void main(String[] args) {
        InputStream is = null;
        OutputStream os = null;
        try {
            is = new FileInputStream("D:\\Documents\\Downloads\\ChromeStandaloneSetup64.exe");
            os = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\ChromeStandaloneSetup64.exe");
            byte[] buff = new byte[1024];
            int b = -1;
            while((b = is.read(buff)) != -1) {
                os.write(buff,0,b);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                os.close();
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
